In [1]:
using Revise,FileIO
y1,x1,y2,x2=load("dirori.jld","y1","x1","y2","x2")
rx1=deg2rad.(x1);rx2=deg2rad.(x2);

Direction and Orientation Tuning Curve


In [3]:
using NeuroAnalysis,DataFrames
plotcondresponse(y1,DataFrame(Orientation=x1),:Orientation)


Out[3]:
0 100 200 300 0 10 20 30 40 Orientation (deg) Response (spike/s) U0

In [4]:
plotcondresponse(y1,DataFrame(Orientation=x1),:Orientation,projection=:polar)


Out[4]:
0 o 315 o 270 o 225 o 180 o 135 o 90 o 45 o 0 10 20 30 40 Orientation (deg) Response (spike/s) U0

In [5]:
plotcondresponse(y2,DataFrame(Orientation=x2),:Orientation)


Out[5]:
0 100 200 300 10 20 30 40 50 Orientation (deg) Response (spike/s) U0

In [6]:
plotcondresponse(y2,DataFrame(Orientation=x2),:Orientation,projection=:polar)


Out[6]:
0 o 315 o 270 o 225 o 180 o 135 o 90 o 45 o 10 20 30 40 50 Orientation (deg) Response (spike/s) U0

Circular Variance


In [7]:
d1=deg2rad(filter(x->x!=0,unique(diff(sort(x1))))[1]);d2=deg2rad(filter(x->x!=0,unique(diff(sort(x2))))[1])
arx1=circaxial.(rx1);arx2=circaxial.(rx2)
ad1=circaxial(d1);ad2=circaxial(d2);

In [8]:
DataFrame(dirvar1 = circvar(rx1,y1,d1),dirvar2 = circvar(rx2,y2,d2),orivar1 = circvar(arx1,y1,ad1),orivar2 = circvar(arx2,y2,ad2))


Out[8]:

1 rows × 4 columns

dirvar1dirvar2orivar1orivar2
Float64Float64Float64Float64
10.2307870.8802780.30120.732038

von Mises and Generalized von Mises


In [9]:
using Plots
plot([vmf,gvmf],-pi,pi,label=["vmf","gvmf"])


Out[9]:
-3 -2 -1 0 1 2 3 0.2 0.4 0.6 0.8 1.0 vmf gvmf

GvM Model Fitting


In [10]:
using LsqFit
gvmfit1 = curve_fit((x,p)->gvmf.(x,p...),rx1,y1,Float64[1,0,0,0,0])
plot(x->gvmf(x,gvmfit1.param...),0,2pi)


Out[10]:
0 1 2 3 4 5 6 0 10 20 30 40 y1

In [11]:
plot(x->gvmf(x,gvmfit1.param...),0:0.01:2pi,proj=:polar)


Out[11]:
0 o 315 o 270 o 225 o 180 o 135 o 90 o 45 o 10 20 30 40 y1

In [12]:
gvmfit2 = curve_fit((x,p)->gvmf.(x,p...),rx2,y2,Float64[1,0,0,0,0])
plot(x->gvmf(x,gvmfit2.param...),0,2pi)


Out[12]:
0 1 2 3 4 5 6 20 30 40 50 y1

In [13]:
plot(x->gvmf(x,gvmfit2.param...),0:0.01:2pi,proj=:polar)


Out[13]:
0 o 315 o 270 o 225 o 180 o 135 o 90 o 45 o 20 30 40 50 y1

vM Model Fitting


In [14]:
vmfit1 = curve_fit((x,p)->vmf.(x,p...,n=2),rx1,y1,Float64[1,0,0])
plot(x->vmf(x,vmfit1.param...,n=2),0,2pi)


Out[14]:
0 1 2 3 4 5 6 0 5 10 15 20 y1

In [15]:
plot(x->vmf(x,vmfit1.param...,n=2),0:0.01:2pi,proj=:polar)


Out[15]:
0 o 315 o 270 o 225 o 180 o 135 o 90 o 45 o 5 10 15 20 25 y1

In [16]:
vmfit2 = curve_fit((x,p)->vmf.(x,p...,n=2),rx2,y2,Float64[1,0,0])
plot(x->vmf(x,vmfit2.param...,n=2),0,2pi)


Out[16]:
0 1 2 3 4 5 6 15 20 25 30 35 40 y1

In [17]:
plot(x->vmf(x,vmfit2.param...,n=2),0:0.01:2pi,proj=:polar)


Out[17]:
0 o 315 o 270 o 225 o 180 o 135 o 90 o 45 o 15 20 25 30 35 40 45 y1

In [ ]: